/-boot ...
BootController.ts
BootLayout.ts
StorageLoader.ts
boot.ts
/-docs
/-docs/CodeMirrorServices
/-docs/api
/-editor
/-files
/-files-old
/-imports
/-layout
/-storage
/-storage/attached
/-storage/attached/api
DetectStorage.ts
LoadStorage.ts
LoadStorageRecipient.ts
UpdateStorage.ts
/-storage/attached/dom
DetectStorage.ts
LoadStorage.ts
UpdateStorage.ts
/-storage/attached/indexedDB
DetectStorage.ts
FileData.ts
LoadStorage.ts
MetadataData.ts
UpdateStorage.ts
functions.ts
/-storage/attached/localStorage
DetectStorage.ts
LoadStorage.ts
UpdateStorage.ts
/-storage/attached/webSQL
/-tests
/-typings
Dom.ts
TypeScriptService.ts
functions.ts
ko.ts
nteapo.html
persistence.api.ts
persistence.ts
shell.ts
teapo.html
teapo.ts
try.html
try.js
x
 
99
      var uniqueKey = this._getUniqueKey();
100
101
      this._storageLoader = new StorageLoader(this.dom, this._storageElem, uniqueKey);
102
      this._storageLoader.loadStorage({
103
        detectionComplete: (err, persistenceName, editedUTC, loadingFromPersistence) =>
104
          this._storageDetectionComplete(err, persistenceName, editedUTC, loadingFromPersistence),
105
        loadProgress: (totalFileCount, loadedFileCount, lastLoadedFileName) =>
106
          this._storageLoadProgress(totalFileCount, loadedFileCount, lastLoadedFileName),
107
        loadComplete: (err, byFullPath, domUpdater, persistenceUpdater) =>
108
          this._storageLoaded(err, byFullPath, domUpdater, persistenceUpdater)
109
      });
110
      
111
    }
112
113
    private _storageDetectionComplete(
114
      err: Error,
115
      persistenceName: string,
116
      editedUTC: number,
117
      loadingFromPersistence) {
118
      if (err) { 
119
        alert('Detection '+err.message);
120
        return;
121
      }
122
123
      this._persistenceName = persistenceName;
124
      this._editedUTC = editedUTC;
125
      this._loadingFromPersistence = loadingFromPersistence;
126
127
      this._layout.setProgressColor('goldenrod');
128
      this._layout.setSmallProgressText(
129
        'Loading files from ' +
130
        (loadingFromPersistence ? persistenceName + ' to dom' : 'dom' + (persistenceName ? ' to ' + persistenceName : '')) +
131
        (editedUTC ? ' edited on ' + new Date(editedUTC) : '') +
132
        '...');
133
    }
134
135
    private _storageLoadProgress(
136
      totalFileCount: number,
137
      loadedFileCount: number,
138
      lastLoadedFileName: string) {
139
140
      this._layout.setProgressColor('green');
141
      this._layout.setSmallProgressText('Loading "' + lastLoadedFileName + '" ' + loadedFileCount + ' of ' + totalFileCount + '...');
142
      this._layout.setProgressRatio(
143
        BootController.initialProgress + BootController.domLoadProgressAmount +
144
        BootController.migrateProgressAmount * loadedFileCount / totalFileCount);
145
      this._fileCount = loadedFileCount;
146
    }
147
148
    private _storageLoaded(
149
      err: Error,
150
      byFullPath: { [fullPath: string]: { [property: string]: string; }; },
151
      domUpdater: storage.attached.UpdateStorage,
152
      persistenceUpdater: storage.attached.UpdateStorage) {
153
      if (err) {
154
        alert('Loading ' + err.message);
155
        return;
156
      }
157
158
      var preciseFileCount = 0;
159
      for (var k in byFullPath) if (byFullPath.hasOwnProperty(k)) {
160
        preciseFileCount++;
161
      }
162
163
      this._layout.setProgressColor('black');
164
      this._layout.setSmallProgressText(
165
        'Loaded ' + preciseFileCount + ' files from ' +
166
        (this._loadingFromPersistence ? this._persistenceName + ' to dom' : 'dom' + (this._persistenceName ? ' to ' + this._persistenceName : '')) +
167
        (this._editedUTC ? ' edited on ' + new Date(this._editedUTC) : '') + '.');
168
      this._layout.setProgressRatio(
169
        BootController.initialProgress + BootController.domLoadProgressAmount +
129:60 primitive type string setSmallProgressText(progressText: string): void